<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="">
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
        <input type="checkbox" name="vehicle">哈哈哈<br>
    </form>
    <button id="quan">全选</button>
    <button id="fan">反选</button>
</body>

</html>
<script src="./jquery-3.4.1.min.js"></script>
<script>
    $("#quan").click(function() {
        $("input").each(function(i, v) {
            v.checked = true;
        })

    });

    $("#fan").click(function() {
        $("input").each(function(i, v) {
            v.checked = !v.checked
        })


    })
</script>